function isConsoleOpen() {
    let isOpen = false;
    const devtools = /./;
    devtools.toString = function () {
        isOpen = true;
        return '';
    };

    console.log("%c", devtools);
    return isOpen;

}

setInterval(() => {
    if (isConsoleOpen()) {
        document.body.innerHTML = " 检测已打开 ";
    }
}, 1000);